package exception;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * @author げっしょく
 * @date 2021/7/24
 */
public class Test4 {
    public static void main(String[] args) {
        Collection<String> list = new ArrayList<>();
        list.add("马保国");
        list.add("张三丰");
        list.add("老天师");
        list.add("张无忌");
        list.add("杨过");
        list.add("张芷箬");
        list.add("炼铜术士");
        Iterator<String> it = list.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
        list.removeIf((String s) -> {
            if(s.charAt(0) == '马' || s.charAt(0) == '炼')
                return true;
            return false;
        });
        System.out.println(list);

    }
}
